package com.wl.studyjob.dbchange.hbase;


import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.hbase.HBaseConfiguration;
import org.apache.hadoop.hbase.HColumnDescriptor;
import org.apache.hadoop.hbase.HTableDescriptor;
import org.apache.hadoop.hbase.TableName;
import org.apache.hadoop.hbase.client.Admin;
import org.apache.hadoop.hbase.client.Connection;
import org.apache.hadoop.hbase.client.ConnectionFactory;
import org.apache.hadoop.hbase.client.Delete;
import org.apache.hadoop.hbase.util.Bytes;

import java.io.IOException;

public class CreateTable {
    public static void main(String[] args) throws IOException {
        Configuration conf = HBaseConfiguration.create();

        conf.set("hbase.zookeeper.quorum","linux121,linux122");
        conf.set("hbase.zookeeper.property.clientPort","2181");

        Connection conn = ConnectionFactory.createConnection(conf);

        Admin admin = conn.getAdmin();


        HTableDescriptor app_user = new HTableDescriptor(TableName.valueOf("app_user"));
        app_user.addFamily(new HColumnDescriptor("friends"));
        admin.createTable(app_user);
        System.out.println(app_user.getTableName() + "表创建成功！！！");





    }
}
